/**
 * @file tal_zigbee_local_auto_create_frame.h
 * @brief This is tal_zigbee_local_auto_create_frame file
 * @version 1.0
 * @date 2021-09-10
 *
 * @copyright Copyright 2021-2022 Tuya Inc. All Rights Reserved.
 *
 */

#ifndef __TAL_ZIGBEE_LOCAL_AUTO_CREATE_FRAME_H__
#define __TAL_ZIGBEE_LOCAL_AUTO_CREATE_FRAME_H__

#include "tuya_cloud_types.h"
#include "tuya_error_code.h"

#ifdef __cplusplus
extern "C" {
#endif

/***********************************************************************
 ********************* constant ( macro and enum ) *********************
 **********************************************************************/
/*
 * 一般仅仅用于dongle合成数据包使用，节点设备不会用到这个文件
 */

#define AUTO_EN         0x01
#define AUTO_DIS        0x00
#define TRIGGER_EDGE    0x00
#define TRIGGER_KEEP    0x80
#define RULE_OR         0x00
#define RULE_AND        0x40
#define DP_KIND_VALUE   0x00
#define DP_KIND_BOOL    0x10
#define DP_KIND_ENUM    0x20
#define DP_KIND_RAW     0x30
#define DP_KIND_STRING  0x40
#define EV_OP_E         0x00
#define EV_OP_NE        0x01
#define EV_OP_B         0x02
#define EV_OP_S         0x03
#define EV_OP_BE        0x04
#define EV_OP_SE        0x05
#define EV_OP_SBE       0x06
#define EV_OP_SB        0x07
#define EV_OP_NSBE      0x08
#define EV_OP_NSB       0x09
#define AC_OP_TOGGLE    0x00
#define AC_OP_SET       0x01
#define AC_OP_ADD       0x02
#define AC_OP_CUT       0x03

/***********************************************************************
 ********************* struct ******************************************
 **********************************************************************/


/***********************************************************************
 ********************* variable ****************************************
 **********************************************************************/


/***********************************************************************
 ********************* function ****************************************
 **********************************************************************/
/**
 * @brief tal_zigbee_local_auto_create_frame_auto_head
 *
 * @param[in] auto_id: auto_id
 * @param[in] attr_enable: attr_enable
 * @param[in] *buf: *buf
 * @param[in] buf_len: buf_len
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */
UINT8_T tal_zigbee_local_auto_create_frame_auto_head(UINT16_T auto_id, UINT8_T attr_enable, UINT8_T *buf, UINT8_T buf_len);

/**
 * @brief tal_zigbee_local_auto_create_frame_sub_event
 *
 * @param[in] pub_address: pub_address
 * @param[in] dpid: dpid
 * @param[in] dpkind: dpkind
 * @param[in] trigger: trigger
 * @param[in] op: op
 * @param[in] a: a
 * @param[in] b: b
 * @param[in] *buf: *buf
 * @param[in] buf_len: buf_len
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */
UINT8_T tal_zigbee_local_auto_create_frame_sub_event(UINT16_T pub_address, UINT8_T dpid, UINT8_T dpkind, UINT8_T trigger, UINT8_T op, UINT16_T a, UINT16_T b, UINT8_T *buf, UINT8_T buf_len);

/**
 * @brief tal_zigbee_local_auto_create_frame_sub_action
 *
 * @param[in] kind: kind
 * @param[in] dpid: dpid
 * @param[in] dpkind: dpkind
 * @param[in] op: op
 * @param[in] a: a
 * @param[in] *datas: *datas
 * @param[in] datas_len: datas_len
 * @param[in] *buf: *buf
 * @param[in] buf_len: buf_len
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */
UINT8_T tal_zigbee_local_auto_create_frame_sub_action(UINT8_T kind, UINT8_T dpid, UINT8_T dpkind, UINT8_T op, UINT16_T a, UINT8_T *datas, UINT8_T datas_len, UINT8_T *buf, UINT8_T buf_len);


#ifdef __cplusplus
}
#endif

#endif /* __TAL_ZIGBEE_LOCAL_AUTO_CREATE_FRAME_H__ */

